<?php


namespace App\Http\Controllers\App;


use App\Exceptions\BasicException;
use App\Http\Controllers\BaseController;
use App\Response\Response;
use Illuminate\Http\Request;

class LotteryDrawController extends BaseController
{
    private $addPoolRepo;

    public function __construct(Request $request)
    {
        $this->addPoolRepo = app('repo_add_pool');
        $drawType = $request->header('drawType');
        if ($drawType == 'stellar') {
            $this->addPoolRepo = app('repo_add_pool_stellar');
        } else if ($drawType == 'senior') {
            $this->addPoolRepo = app('repo_add_pool_senior');
        } else if ($drawType == 'gashapon') {
            $this->addPoolRepo = app('repo_add_pool_gashapon');
        } else if ($drawType == 'fantasy') {
            $this->addPoolRepo = app('repo_add_pool_fantasy');
        } else if ($drawType == 'frag') {
            $this->addPoolRepo = app('repo_add_pool_frag');
        }
    }

    public function list(Request $request)
    {
        $data = $this->addPoolRepo->list($request->input());
        return Response::sendData($data);
    }

    public function save(Request $request)
    {
        $data = $this->addPoolRepo->save($request->input());
        return Response::sendData([]);
    }

    public function delete(Request $request)
    {
        $data = $this->addPoolRepo->delete($request->input('id'));
        return Response::sendData([]);
    }


    public function checkList(Request $request)
    {
        $data = $this->addPoolRepo->checkList($request->input());
        return Response::sendData($data);
    }

    public function checkSave(Request $request)
    {
        $data = $this->addPoolRepo->checkSave($request->input());
        return Response::sendData([]);
    }

    public function checkDelete(Request $request)
    {
        $data = $this->addPoolRepo->checkDelete($request->input('id'));
        return Response::sendData([]);
    }

    public function changeGameAccount(Request $request)
    {
        $data = $this->addPoolRepo->changeGameAccount($request->input());
        return Response::sendData([]);
    }

    public function getGameAccount(Request $request)
    {
        $data = $this->addPoolRepo->getGameAccount($request->input('game_type'));
        return Response::sendData($data);
    }

    public function getAddPoolAccountRecord(Request $request)
    {
        $data = $this->addPoolRepo->getAddPoolAccountRecord($request->input());
        return Response::sendData($data);
    }

    public function getCheckRecord(Request $request)
    {
        $data = $this->addPoolRepo->getCheckRecord($request->input());
        return Response::sendData($data);
    }

    public function getGiftConfig(Request $request)
    {
        $data = $this->addPoolRepo->getGiftConfig($request->input());
        return Response::sendData($data);
    }

    public function setGiftConfig(Request $request)
    {
        $data = $this->addPoolRepo->setGiftConfig($request->input());
        return Response::sendData([]);
    }

    public function getAppointGift(Request $request)
    {
        $data = $this->addPoolRepo->getAppointGift($request->input());
        return Response::sendData($data);
    }

    public function setAppointGift(Request $request)
    {
        $data = $this->addPoolRepo->setAppointGift($request->input());
        return Response::sendData([]);
    }

    public function getWholeGameUser(Request $request)
    {
        $data = $this->addPoolRepo->getWholeGameUser($request->input());
        return Response::sendData($data);
    }

    public function getWholeGameCheckList(Request $request)
    {
        $data = $this->addPoolRepo->getWholeGameCheckList($request->input());
        return Response::sendData($data);
    }

    public function wholeGameCheckSave(Request $request)
    {
        $data = $this->addPoolRepo->wholeGameCheckSave($request->input());
        return Response::sendData([]);
    }

    public function wholeGameCheckDelete(Request $request)
    {
        $data = $this->addPoolRepo->wholeGameCheckDelete($request->input('id'));
        return Response::sendData([]);
    }

    public function getWholeGameCheckRecord(Request $request)
    {
        $data = $this->addPoolRepo->getWholeGameCheckRecord($request->input());
        return Response::sendData($data);
    }

    public function getDisplayCate(Request $request)
    {
        $data = $this->addPoolRepo->getDisplayCate($request->input());
        return Response::sendData($data);
    }

    public function setDisplayCate(Request $request)
    {
        $data = $this->addPoolRepo->setDisplayCate($request->input());
        return Response::sendData([]);
    }

    public function displayCateDel(Request $request)
    {
        $data = $this->addPoolRepo->displayCateDel($request->input('id'));
        return Response::sendData([]);
    }

}
